package com.skytech.component.crawler.task;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
public class ScheduledTask {
    @Autowired
    private CrawlerTask crawlerTask;
    @Value("${crawler.task.use}")
    private Boolean use;

    private static final Logger log = LoggerFactory.getLogger(ScheduledTask.class);
    @Scheduled(cron = "0 00 02 ? * *")
    public void start(){
        log.debug("定时任务开始");
        if(use) {
            crawlerTask.startChromeTask();
        }
    }
}
